package com.moore.controller;

import com.moore.bean.Candidate;
import com.moore.dto.ResponseData;
import com.moore.service.PersonalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

@RequestMapping("/personal")
@RestController
public class PersonalController {

    @Autowired
    private PersonalService personalService;
    @Autowired
    private RedisTemplate<String,String> redisTemplate;
    @RequestMapping("/test")
    private ResponseData test(){
        String uuid="test";
        String code = "3379";
        //存入redis
        redisTemplate.opsForValue().set(uuid,code,60, TimeUnit.SECONDS);
        return ResponseData.ok("success");
    }
    //获取应聘者个人信息
    @RequestMapping("/getCandidateMessage")
    private ResponseData getCandidateMessage(Integer candidateId){
        return personalService.getCandidateMessage(candidateId);
    }
    //修改应聘者个人信息
    @RequestMapping("/updateCandidateMessage")
    private ResponseData updateCandidateMessage(@RequestBody Candidate candidate){
        return personalService.updateCandidateMessage(candidate);
    }
}
